Fixed bug in subs