Fixed bug with variable getting improper type