preliminary error check