Only remove directories if they exist
Fix case sensitivity issue