fixed some bugs and improved iPad support