Fixed bug with code