Fixing crashes: change to static allocation