exception handling and new locking mechnism