Fix for orientation change crash (issue #1)

Please integrate this changeset and resubmit to PhoneGap Build. Before someone submits his fork.