Fixed some bugs in mavericks