Fixed issues with crashing