Fix some bugs, add constraint to portrait mode