Fixed improper exception handling

@SirCmpwn merge at will