Fixed bug with returning nil