Fixed crash when autolayout is used