Fixed bug regarding slot and added test code