refactored basis.jl to use @assert