fixed unexpected bugs for the future