Bug fix for spaces in certain conditions