bug fixes

bug fixes, avoid crashing on tablets