Hopefully fixing undefined bug