bug fix
error catching