fixed some space handling