stupid stack allocation bug