Properly handle spaces in keys