fixed bug in space char detection