added some error catching

Signed-off-by: Eliminioa <crazymadgenius@gmail.com>