function wasn't returning the byte array it was supposed to, added return statement inside try