1) Properly initialize variables. 2) Just because a directory is empty doesn't mean it doesn't exist.