bug fixed, added try block