fix undefined error when using open