remove trailing ws + couple fixes