fixes application crashes and #227