Added getLastError and reverted the other changes