Fixed bugs in positioning