fixed bug in createView method