This should fix a bug caused by comparing string literals to directories. It should also be safer, using "os" module to access paths.